# 测试
import random
import time
from controller1 import *
import threading

def p(x):print(x)
def jc():
    t=1
    while 1:
        t=t*2
        time.sleep(0.0001)

if __name__ == "__main__":

    # Controller().start()可以不传参


    showlist={'aa':0,'bb':10,'cc':111,'dd':1,'aa2':0,'bb2':10,'cc2':111,'dd2':1,'aa3':0,'bb3':10,'cc3':111,'dd3':1}
    functionList=['1','print(1)','self.p(1)']

    con=Controller(showlist,functionList)
    con.p=p
    con.start()

    # for i in range(2000):
    #     threading.Thread(target=jc).start()

    while 1:
        # 要加锁
        con.gLock.acquire()

        showlist['aa']=random.randint(0,100)
        showlist['bb']+=1
        showlist['dd']=showlist['dd']*2
        showlist['aa2']=random.randint(0,100)
        showlist['bb2']+=1
        showlist['dd2']=showlist['dd']*2

        con.gLock.release()

        time.sleep(1)